function shuaka(fn, delay){
    let timerId = null
    return function(){
        if(timerId){window.clearTimeout(timerId)}
        timerId = setTimeout(()=>{
            fn()
            timerId = null
        },delay)
    }
}
const startshuaka = shuaka(()=>console.log('最后一个人上车了 公交可以开了'),5000)

startshuaka()
startshuaka()
startshuaka()
startshuaka()
startshuaka()
startshuaka()
startshuaka()
startshuaka()
startshuaka()
startshuaka()